home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-01-29 | 2.0 KB | 53 lines | [TEXT/IGR0] |
- | Version 1.10, 12/31/95
- | Updated for Igor Pro 3.0
-
- #pragma rtGlobals=1
-
- | XYToWave1(xWave, yWave, wWaveName, numPoints)
- | Generates a waveform from an XY pair.
- | The name of the output waveform must not be the same as the x or y input wave.
- | The macro makes the assumption that the input waves are already sorted.
- | You can sort with: Sort xWave, xWave, yWave
- | If you have blanks (NaNs) in your input data, this function will give you blanks
- | in your output waveform as well. If you don't want this, you can try the
- | XYToWave2 function below.
- Function XYToWave1(xWave, yWave, wWaveName, numPoints)
- Wave xWave | x wave in the XY pair
- Wave yWave | y wave in the XY pair
- String wWaveName | name to use for new waveform wave
- Variable numPoints | number of points for waveform
-
- Make/O/N=(numPoints) $wWaveName | make waveform
- Wave wWave= $wWaveName
- WaveStats/Q xWave | find range of x coordinates
- SetScale/I x V_min, V_max, wWave | set X scaling for waveform
- wWave = interp(x, xWave, yWave) | do the interpolation
- End
-
- | XYToWave2(xWave, yWave, wWaveName, numPoints)
- | Generates a waveform from an XY pair.
- | The name of the output waveform must not be the same as the x or y input wave.
- | It must be a simple wave name, not a full or partial path plus wave name.
- | numPoints must be at least as large as the number of points in the XY pair.
- | The input waves need not be sorted.
- | This function interpolates through the NaNs.
- Function XYToWave2(xWave, yWave, wWaveName, numPoints)
- Wave xWave | x wave in the XY pair
- Wave yWave | y wave in the XY pair
- String wWaveName | name to use for new waveform wave
- Variable numPoints | number of points for waveform
-
- String cmd
- String xWaveName, yWaveName
- String format
-
- wWaveName= PossiblyQuoteName(wWaveName)
-
- xWaveName = GetWavesDataFolder(xWave,4) | partial path including possibly quoted wave name
- yWaveName = GetWavesDataFolder(yWave,4)
- format = "Interpolate/N=(%d)/E=2/Y=%s %s /X=%s"
- sprintf cmd, format, numPoints, wWaveName, yWaveName, xWaveName
- Execute cmd
- End
-
-